<#macro paging paginator callable="" count=count>
<script type="text/javascript">
    $(function() {
        $("span.link").hover(function() {
            $(this).addClass("link-hover");
        }, function() {
            $(this).removeClass("link-hover");
        });
    });
</script>
    <#assign  url="">
<span>${paginator.totalcount} results</span>
    <#if (paginator.page<paginator.lastPage)><span class="link"
                                                   onclick="${callable}(${paginator.page+1},${count});">Next &raquo;</span></#if>
    <#if (paginator.page<paginator.lastPage-6)>
    <span class="link" onclick="${callable}(${paginator.lastPage},${count})">${paginator.lastPage}</span>
    <span>...</span>
        <#list 0..4 as j>
        <span class="link" onclick="${callable}(${paginator.page-j+5},${count})">${paginator.page-j+5}</span>
        </#list>
        <#elseif paginator.lastPage!=paginator.page>
            <#list 0..paginator.lastPage-paginator.page-1 as k>
            <span class="link" onclick="${callable}(${paginator.lastPage-k},${count})">${paginator.lastPage-k}</span>
            </#list>
    </#if>
<span class="current">${paginator.page}</span>
    <#if (paginator.page>6)>
        <#list 0..4 as i>
            <#assign p = paginator.page - i -1/>
        <span class="link" onclick="${callable}(${p},${count})">${p}</span>
        </#list>
        <#if (paginator.page>7)>
        <span>...</span>
        </#if>
    <span class="link" onclick="${callable}(1,${count})">1</span>
        <#else>
            <#if (paginator.page>1)>
                <#list paginator.page..2 as j>
                <span class="link" onclick="${callable}(${j-1},${count})">${j-1}</span>
                </#list>
            </#if>
    </#if>
    <#if (paginator.page>1)><span class="link" onclick="${callable}(${paginator.page-1},${count})">&laquo;
        Prev</span></#if>
</#macro>

<#function getDateString offsetDaysFromNow>
    <#return stack.findValue("@com.derbysoft.core.utils.DateTimeUtils@getDateString(" + offsetDaysFromNow + ")")>
</#function>

<#function getYear>
    <#return stack.findValue("@com.derbysoft.core.utils.DateTimeUtils@getYear()")>
</#function>